package ge.home.app;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import ge.home.app.Battery.Battery;
import ge.home.app.Camera.CameraFns;


/**
 * Created by BACHO on 3/4/14.
 */
public class FragmentMng extends Fragment {
    public static Fragment newInstance(int itemId, String name) {
        switch (itemId) {
            case R.string.m_item_battary:
                return new Battery(name);
            case R.string.m_item_camera:
                return new CameraFns();
            default:
                return new EmptyFragment(name);
        }

    }

    private static final class EmptyFragment extends Fragment {
        private String text;

        private EmptyFragment(String text) {
            this.text = text;
        }

        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                 Bundle savedInstanceState) {
            TextView textView = new TextView(getActivity());
            textView.setText(text);
            return textView;
        }

    }
}
